#ifndef BABYENGINE_TIMING_CLASS_H__
#define BABYENGINE_TIMING_CLASS_H__

#include "Material.h"

#ifdef _WIN32
class Timing
{
public:
    Timing(void);
    ~Timing(void);

    static Timing& getInstance(void);

    /**	Retrieves the elapsed, in seconds, time since the last resume
     */
    double getElapsedTime(void);
    /**	Retrieves the last tick
     */
    unsigned long int getLastTick() const
    {
        return lastTick;
    }

    /** Updates timer state
     */
    void tick(void);

    /** Verifies paused state
     */
    bool isPaused() const
    {
        return paused;
    }

    /** Pauses this timer
     */
    void pause(void);

    /** Resumes this timer
     */
    void resume(void);

    /** Gets the milliseconds
     */
    double getMilliseconds(void);

    /** Gets the system time in milliseconds.
     */
    double getSystemTime(void);

protected:
private:

    unsigned long int lastTick;
    double elapsedTime;
    bool paused;
    //uint64_t lastTick;
};
#else

/**
 *
 */
class Timing
{
public:
    Timing(void);
    ~Timing(void);

    static Timing& getInstance(void);

    /**	Retrieves the elapsed, in seconds, time since the last resume
     */
    double getElapsedTime(void);
    /**	Retrieves the last tick
     */
    unsigned long int getLastTick() const
    {
        return lastTick;
    }

    /** Updates timer state
     */
    void tick(void);

    /** Verifies paused state
     */
    bool isPaused() const
    {
        return paused;
    }

    /** Pauses this timer
     */
    void pause(void);

    /** Resumes this timer
     */
    void resume(void);

    /** Gets the milliseconds between the last tick and now.
     */
    double getMilliseconds(void);

    /** Gets the system time in seconds.
     */
    double getSystemTime(void);

protected:
private:

    double lastTick;
    double elapsedTime;
    bool paused;
    //uint64_t lastTick;
};

#endif

#endif /* BABYENGINE_TIMING_CLASS_H__ */
